cmake_minimum_required (VERSION 3.10)

project(ToGray LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

IF (WIN32)
    MESSAGE(STATUS "Now is windows")
ELSEIF (APPLE)
    MESSAGE(STATUS "Now is Apple systens.")
ELSEIF (UNIX)
    MESSAGE(STATUS "Now is UNIX-like OS's. Including aPPLE os x  and CygWin")
ENDIF ()

#设置输出目录
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
    set(platform x64)
ELSE()
    set(platform x86)
ENDIF() 

set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../${platform}/${CMAKE_BUILD_TYPE})
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../${platform}/${CMAKE_BUILD_TYPE})

include_directories(${PROJECT_SOURCE_DIR}/include)

FILE(GLOB_RECURSE HEADERS   "include/*.h")
FILE(GLOB_RECURSE SOURCES   "src/*.cpp")

find_package(OpenCV REQUIRED)
if(OpenCV_FOUND)
	include_directories(${OpenCV_INCLUDE_DIRS})
endif() 

add_executable(
    ${PROJECT_NAME} 
    ${HEADERS}
    ${SOURCES}
)

if(OpenCV_FOUND)
	target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
endif() 
